﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microhard.ApproveFlow.Buz.Interfaces;
using Microhard.Core.DBUtility;
using Microhard.ApproveFlow.Buz.DataAccess;
using Microhard.ApproveFlow.Buz.DTO;
using Microhard.Core;
using Microhard.ApproveFlow.Buz.Msg;

namespace Microhard.ApproveFlow.Buz.Impls
{
    public class ApproveResultImpl : IApproveResult
    {
        public Core.DBUtility.ExecutedResult Add(Models.ApproveResultModel model)
        {
            ExecutedResult rtn = new ExecutedResult();
            MicroHardApproveFlowEntities db = new MicroHardApproveFlowEntities();

            var op = model.ToEntity();
            op.CreatTime = DateTime.Now;

            try
            {
                db.t_WorkflowDataApproveResult.AddObject(op);
                db.SaveChanges();
            }
            catch (System.Exception ex)
            {
                rtn.ErrorMsg.Add(DBOperationFailedStatus.AddFailed, ApproveResultMsg.AddFailed);
                Log.Error("IApproveResult.Add", ex);
            }
            return rtn;
        }

        public Core.DBUtility.ExecutedResult Update(Models.ApproveResultModel model)
        {
            throw new NotImplementedException();
        }

        public Core.DBUtility.ExecutedResult Delete(List<Guid> ids)
        {
            throw new NotImplementedException();
        }

        public Core.DBUtility.ExecutedResult Delete(Models.ApproveResultModel model)
        {
            throw new NotImplementedException();
        }

        public Models.ApproveResultModel GetModelByID(Guid id)
        {
            throw new NotImplementedException();
        }

        public Models.ApproveResultModel GetModelByModel(Models.ApproveResultModel model)
        {
            throw new NotImplementedException();
        }

        public List<Models.ApproveResultModel> Query(Models.ApproveResultModel Model, int pageIndex, int pageSize, out int totalCount)
        {
            throw new NotImplementedException();
        }

        public List<Models.ApproveResultModel> Query(Models.ApproveResultModel Model)
        {
            throw new NotImplementedException();
        }

        public Core.DBUtility.ScopeResult scope
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }
    }
}
